package com.bawei.module_home.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.bawei.module_home.HomeListFragment
import com.bawei.module_home.HomePlayFragment

class HomePageAdapter constructor(private val fragment:MutableList<HomeListFragment>,fm:FragmentManager,lifecycle:Lifecycle):FragmentStateAdapter(fm,lifecycle){
    override fun getItemCount(): Int {
        return fragment.size
    }


    override fun createFragment(position: Int): Fragment {
        return fragment[position]
    }

    override fun getItemId(position: Int): Long {
        return position.toLong()//给每一个Fragment定义唯一的ID
    }

}